#include <queObj.h>
int queObjInit(void *qotPtr, queOptType qotSize, queOptType objsize)
{
    queOptType tmpDataSize = (qotSize - queObjHdSz) / objsize * objsize;
    struct queObjStruct *tmpOpt = (struct queObjStruct *)qotPtr;
    if (!tmpOpt)
    {
        // logerrorc("");
        return -1;
    }
    tmpOpt->objSz = objsize;
    // printf("quesize=%u,hsize=%u,bfsize=%u,number=%u\n", qotSize, (queOptType)queObjHdSz, tmpDataSize, tmpDataSize / objsize);
    return queOptInit(&tmpOpt->qopt, tmpDataSize + queOptHeadSize);
}
int queObjWrite(void *qotPtr, const void *qotVal)
{
    struct queObjStruct *tmpOpt = (struct queObjStruct *)qotPtr;
    if (!tmpOpt)
    {
        // logerrorc("");
        return -1;
    }
    return queOptWrite(&tmpOpt->qopt, qotVal, tmpOpt->objSz);
}
int queObjRead(void *qotPtr, void *qotVal, uint8_t rdChnl)
{
    struct queObjStruct *tmpOpt = (struct queObjStruct *)qotPtr;
    if (!tmpOpt)
    {
        // logerrorc("");
        return -1;
    }
    return queOptRdFix(&tmpOpt->qopt, rdChnl, (uint8_t *)qotVal, tmpOpt->objSz);
}
